#include<iostream>
#include<cstdio>
#include<algorithm>
#define N 301
#define mod 1000000007
using namespace std;
int read()
{
	char c=0;
	int sum=0;
	while (c<'0'||c>'9') c=getchar();
	while ('0'<=c&&c<='9') sum=sum*10+c-'0',c=getchar();
	return sum;
}
void Adder(int &x,int d)
{
	x+=d;
	if (x>=mod) x-=mod;
	return;
}
int n,dp[N+1][N+1],DP[N+1][N+1][N+1],delta[N+1][N+1][N+1],ans;
char c[N+1];
int main()
{
	//freopen("bracket.in","r",stdin);
	//freopen("bracket.out","w",stdout);
	n=read();
	for (int i=1;i<=n;++i) cin>>c[i];
	if (n&1)
	{
		puts("0");
		return 0;
	}
	dp[0][0]=1;
	for (int i=1;i<=n;++i)
		for (int j=0;j<=i;++j)
		{
			if (j&&c[i]!=')') Adder(dp[i][j],dp[i-1][j-1]);
			if (j+1<=i-1&&c[i]!='(') Adder(dp[i][j],dp[i-1][j+1]);
		}
	Adder(ans,dp[n][0]);
	for (int i=1;i<=n+1;++i)
	{
		for (int j=i-1;j<=n;++j)
			for (int k=0;k<=n;++k)
				for (int t=0;t<=n;++t)
					DP[j][k][t]=0;
		DP[i-1][0][0]=1;
		for (int j=i;j<=n;++j)
			for (int k=0;k<=j-i;++k)
				for (int t=k;t<=j-i;++t)
					if (DP[j-1][k][t])
					{
						if (c[j]!=')') Adder(DP[j][k+1][max(t,k+1)],DP[j-1][k][t]);
						if (c[j]!='('&&k) Adder(DP[j][k-1][t],DP[j-1][k][t]);
					}
		for (int j=i-1;j<=n;++j)
			for (int k=0;k<=j-i+1;++k)
				Adder(delta[i][j][k],DP[j][0][k]);
	}
	for (int i=1;i<=n;++i)
		for (int j=i+1;j<=n;++j)
			Adder(ans,1ll*dp[i-1][0]*dp2[j+1][0]%mod*delta[i+1][j-1]%mod);
	solve();
	reverse(c+1,c+n+1);
	for (int i=1;i<=n;++i)
		if (c[i]!='x')
			c[i]^='('^')';
	solve();
	return 0;
}
